<template>
    <div>
        <h3>Didi爱玩{{ hero }}</h3>
    </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
    name: "Didi",
    data() {
        return {
            hero: "卡莎",
        };
    },
    // Didi组件挂载的时候给中介组件挂载一个事件，用来接收Gege组件传递的值
    mounted() {
        PubSub.subscribe("changeHero", (msgName, hero) => {
            this.hero = hero
        })
    },
};
</script>

<style></style>
